<?php

namespace App\Http\Controllers\Api;

use App\Api\Helpers\ApiResponse;
use App\Http\Controllers\Controller as BaseController;
use Illuminate\Http\Request;

class Controller extends BaseController
{
    use ApiResponse;


    /**
     * 获取分页大小
     * @param string $key
     * @return mixed
     */
    public function getPageSize($key = 'pageSize')
    {
        $allowPageSize = [15, 20, 40, 60, 100];
        $pageSize = request()->input($key, 15);

        if (in_array($pageSize, $allowPageSize)){
            return $pageSize;
        }
        return $allowPageSize[0];
    }
}
